package com.mocoder.chatdemo;

import com.mocoder.chatdemo.controller.MainController;
import com.mocoder.chatdemo.protocol.MsgServer;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("main.fxml"));
        Parent root = loader.load();
        primaryStage.setTitle("聊天工具");
        Scene scene = new Scene(root, 800, 600);
        primaryStage.setScene(scene);
        primaryStage.show();
        MainController controller = loader.getController();
        MsgServer.startServer(controller);
        controller.onUILoad();
    }

    public static void main(String[] args) {
        launch(args);
    }

}
